<template>
    <div class="filtercard">
        <div class="filtertitle">答题卡</div>
        <div class="filterbody">
            <div class="dtklist">
                <template v-if="mkend">
                    <div class="dtkitem" v-for="(answer,anindex) in answerlist" :key="answer.id"
                         :class="{'right':answer.st=='1' ,'wrong':answer.st=='2'}"
                          @click="swiperJump(anindex)">
                        <div class="dtindex">{{anindex+1}}</div><div class="xm">{{answer.an}}</div>
                    </div>
                </template>
                <template v-else>
                    <div class="dtkitem" v-for="n in tmNum" :key="n" :class="[mkend ? answer.status : '']" @click="swiperJump(n)">
                        <div class="dtindex">{{n+1}}</div><div class="xm">{{answerlist[n] ? answerlist[n] : ''}}</div>
                    </div>
                </template>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        props:{
            answerlist:{
                type: Array,
                default: () => []
            },
            mkend:{
                type: Boolean,
                default: false
            },
            tmNum:{
                type: Number,
                default: false
            }
        },
        name: "dtk",
        created () {
        },
        computed: {
        },
        methods: {
            swiperJump(index){
                this.$emit('swipego', index)
            }
        }
    };
</script>

<style scoped>
	.filtertitle{font-size: 28rpx; padding: 15rpx;}
    .filterbody{ max-height: 70vh; overflow-y: scroll; overflow-x: hidden;  }
    .dtklist{ display: flex; justify-content: flex-start; flex-wrap: wrap; margin-bottom: 10px; padding: 0px 10px; align-items: center; box-sizing: border-box; }
    .dtklist .dtkitem{ display: flex; line-height: 40rpx; margin: 10rpx 0; font-size: 24rpx; vertical-align: top; width: 20%; justify-content: flex-start; }
    .dtklist .dtkitem .xm{ display: inline-block; background: #eee; color: #0d65ff; font-size: 24rpx; border-radius: 3px; text-align: center; padding: 0px 10rpx;
        width: 40rpx; height: 40rpx; margin-left: 10rpx; box-sizing: border-box; }
	.dtklist .dtkitem .dtindex{ width: 40rpx; }
    .dtklist .dtkitem.right .xm{ background: #07c160; color: #fff; }
    .dtklist .dtkitem.wrong .xm{ background: #fc1047; color: #fff; }
</style>